package service.impl;

import dao.IGoodsSortDao;
import model.GoodsSort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import service.IGoodsSortService;

import java.util.List;

/**
 * @aythor:侯仪澳
 * @data:2022/7/25
 */
@Service
public class GoodsSortService implements IGoodsSortService {
    @Autowired
    private IGoodsSortDao goodsSortDao;

    //查询一级分类
    @Override
    public List<GoodsSort> queryOneSort(GoodsSort goodsSort) {
        return goodsSortDao.queryGoodsSort(goodsSort);
    }

    //添加分类
    @Override
    public String addGoodsSort(GoodsSort goodsSort) {
        int count = goodsSortDao.addGoodsSort(goodsSort);
        if (count == 1){
            return "1";
        }else {
            return "0";
        }

    }

    //删除分类
    @Override
    public String del(Integer id) {
        int count = goodsSortDao.del(id);
        if (count == 1){
            return "1";
        }else {
            return "0";
        }
    }
}
